-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplified event-based communicator interface #106
Conversation
jovanbulck
commented
Apr 20, 2016
•
edited
Loading
edited
Improved cohesion: worker catches browser exceptions and indicates the kind of error to the communicator, which is the sole responsible to deliver the appropriate error message to the end user and restore the screen/cursor. Worker indicates the error via a code (int) for now, but we might consider using a dedicated ErrorReport object that includes more information, depending on the type of error (eg rccode, inst, IP address, html dump, stacktrace, ...) Also kicked out much of the logout functionality for readability purposes. We'll re-introduced logout to the code base after the beta milestone.
self.print_fail() | ||
## fail gracefully | ||
self.finalize_session(False) | ||
## provide the user with an appropriate error message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this actually smells very bad. I'm working on refactoring this to use explicit communicator methods for each kind of failure
This refactors the single parameterized method into a set of _explicit_ methods for each kind of expected failure, with additional info passed as parameters to the communicator. Likewise, _unexpected_ failure (i.e. exceptions) are handled via a single 'eventFailureInternalError' communicator method that takes the traceback as an argument. This nicely decouples visualisation concerns from worker functionality, and ensures all kinds of failures are handled gracefully.
Use the Python atexit module to ensure the eventExit() method of the running communicator is always called. This nicely allows a communicator to for example redraw the cursor (cf issue #9). Also improved the readibility of the browser URL requests, and added a timeout for all remote server requests.
9fd8a6d
to
0bf2073
Compare
0bf2073
to
fd82a1f
Compare
@GijsTimmers have a look at the changes: I think this can be merged. Also fixed some code quality checks and Travis CI script |
The lazy importing mechanism only imports a communicator when it has been requested by the front-end, via the fabriek. This ensures an end-user does not have to install all the dependencies for all the communicators in order to run kotnetcli. The front-end is thus responsible to catch any ImportErrors thrown at communicator creation time. This nicely maintains the behavior that *only* the front-end and the communicators encapsulate user interaction + only the front-end or worker may terminate (sys.exit) the program. This fixes issue #9 .
Looking good, thanks for the hard work. |